using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OracleClient;

using DQS.EL;

namespace DQS.DAL
{
    public static class DQ_QueryService
    {
        public static int NewQueryID(int argUserID)
        {
            int queryID = 0;
            String sqlStr = "DQ_NewQueryID_P";
            OracleParameter[] _param ={
                new OracleParameter("User_ID",OracleType.Number),
                new OracleParameter("Query_ID",OracleType.Number)			    
			};
            _param[0].Value = argUserID;
            _param[1].Direction = ParameterDirection.Output;            
            OracleHelper.ExecuteNonQuery(sqlStr, CommandType.StoredProcedure, _param);
            queryID = Int32.Parse(_param[1].Value.ToString());
            return queryID;
        }

        public static DataSet GetQueryResult(int argQueryId)
        {
            DataSet ds = new DataSet();
            String sqlStr = "DQ_GetResult_Pk.GetResult";
            OracleParameter[] _params = { 
                new OracleParameter("queryid",OracleType.VarChar,20),
                new OracleParameter("resultSet",OracleType.Cursor)
            };
            _params[0].Value = argQueryId.ToString();
            _params[1].Direction = ParameterDirection.Output;
            ds = OracleHelper.ExecuteDataSet(sqlStr, CommandType.StoredProcedure, _params);
            return ds;
        }
    }
}
